package com.example.administrator.mydemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity implements TextWatcher {
    private EditText viewById;
    private MyProgressView mSeekbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        viewById = (EditText) findViewById(R.id.et_hhe);
        viewById.addTextChangedListener(this);

        mSeekbar = (MyProgressView) findViewById(R.id.myseekbar);
        mSeekbar.setMax(30);
        mSeekbar.setProgress(4);
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
        if (TextUtils.isEmpty(s)) return;
        mSeekbar.setProgress(Integer.parseInt(s.toString()));
    }

    @Override
    public void afterTextChanged(Editable s) {

    }
}
